import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/major_hazard/hazard_archive_tree_entity.dart';
import 'package:enterprise_v6_app/app/data/common/choice_bean.dart';


HazardArchiveTreeEntity $HazardArchiveTreeEntityFromJson(Map<String, dynamic> json) {
  final HazardArchiveTreeEntity hazardArchiveTreeEntity = HazardArchiveTreeEntity();
  final List<HazardArchiveTreeEntity>? children = (json['children'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<HazardArchiveTreeEntity>(e) as HazardArchiveTreeEntity).toList();
  if (children != null) {
    hazardArchiveTreeEntity.children = children;
  }
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    hazardArchiveTreeEntity.companyCode = companyCode;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    hazardArchiveTreeEntity.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    hazardArchiveTreeEntity.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    hazardArchiveTreeEntity.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    hazardArchiveTreeEntity.deleted = deleted;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    hazardArchiveTreeEntity.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    hazardArchiveTreeEntity.name = name;
  }
  final String? pid = jsonConvert.convert<String>(json['pid']);
  if (pid != null) {
    hazardArchiveTreeEntity.pid = pid;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    hazardArchiveTreeEntity.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    hazardArchiveTreeEntity.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    hazardArchiveTreeEntity.updateDate = updateDate;
  }
  return hazardArchiveTreeEntity;
}

Map<String, dynamic> $HazardArchiveTreeEntityToJson(HazardArchiveTreeEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['children'] = entity.children.map((v) => v.toJson()).toList();
  data['companyCode'] = entity.companyCode;
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['pid'] = entity.pid;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  return data;
}

extension HazardArchiveTreeEntityExtension on HazardArchiveTreeEntity {
  HazardArchiveTreeEntity copyWith({
    List<HazardArchiveTreeEntity>? children,
    String? companyCode,
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    String? id,
    String? name,
    String? pid,
    String? updateBy,
    String? updateById,
    String? updateDate,
  }) {
    return HazardArchiveTreeEntity()
      ..children = children ?? this.children
      ..companyCode = companyCode ?? this.companyCode
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..pid = pid ?? this.pid
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate;
  }
}
